package it.unibo.convoycruisecontrol.chiefboatsubsystem.test.mock;

import it.unibo.convoycruisecontrol.chiefboatsubsystem.IControlPanel;
import it.unibo.convoycruisecontrol.chiefboatsubsystem.TimingSupervisor;
import it.unibo.location.LocationDevice;
import it.unibo.util.information.InformationConverter;
import it.unibo.util.timer.TimerEvent;

public class MockTimingSupervisor extends TimingSupervisor 
{
	private long firstTimerFiredTime = 0;
	
	public MockTimingSupervisor(int timeLimit, IControlPanel controlPanel, LocationDevice locationDevice, InformationConverter informationConverter) throws Exception
	{
		super(timeLimit, controlPanel, locationDevice, informationConverter);
	}
	
	public void setLastInfoReceived(int boatNumber)
	{
		lastInfoReceived = boatNumber;
	}
	
	@Override
	public void newInformations() {
		super.newInformations();
		firstTimerFiredTime = System.currentTimeMillis();
	}
	
	@Override
	public void onTimerFired(TimerEvent event) 
	{
		super.onTimerFired(event);
		firstTimerFiredTime = System.currentTimeMillis() - firstTimerFiredTime;
	}
	
	public long getFirstTimerFiredTime()
	{
		return firstTimerFiredTime;
	}
}
